<?php
class BaseModelObject {
    /**
     * private log object
     * @var object
     */
    private $_log = NULL;
    /**
     * construntor
     */	
	public function __construct() {
	}
	/**
	 * class to string
	 * @return string
	 */
	public function toString() {
		$class = get_class($this);
		return $class;
	}
	/**
	 * log the message 
	 * @param string $msg
	 * @param int $type
	 * @return bool
	 */
	public function log($msg, $type=LOG_ERROR) {
		if (is_null($this->log)) {
			$this->_log = new Log();
		}
		if (!is_string($msg)) {
			$msg = print_r($msg, true);
		}
		return $this->_log->write($msg, $type);
	}
	/**
	 * error template show
	 * @param string $method
	 * @param mixed $message, optional
	 */
	public function error($method, $message = array()) {
		$error = new Error();
		$error->$method($message);
	}
	/**
	 * abort the script running
	 * @param int $status, 0~255
	 */
	public function stop($status = 0) {
		exit($status);
	}
}
?>